<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增补考信息')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-resit-add">
            <input name="courseId" class="form-control"  th:value="${courseId}" type="hidden"/>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">开启时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="startTime" class="form-control" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="endTime" class="form-control" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="remark" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "cws/resit"
        $("#form-resit-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-resit-add').serialize());
            }
        }

        $("input[name='startTime']").datetimepicker({
            format: 'yyyy-mm-dd hh:ii:ss',
            minView: "month",
            todayBtn:  true,
            autoclose: true,
        }).on('changeDate', function(event) {
            event.preventDefault();
            event.stopPropagation();
            var startTime = event.date;
            $("input[name='endTime']").datetimepicker('setStartDate', startTime);
        });

        $("input[name='endTime']").datetimepicker({
            format: 'yyyy-mm-dd hh:ii:ss',
            minView: "month",
            todayBtn:  true,
            autoclose: true,
        }).on('changeDate', function(event) {
            event.preventDefault();
            event.stopPropagation();
            var endTime = event.date;
            $("input[name='startTime']").datetimepicker('setEndDate', endTime);
        });
    </script>
</body>
</html>